
GameImages = Class.extend({
    
    init: function (id) {
    	this.id=id;
        this.imageSrcs = ['../images/game/enemy1.png',
                            '../images/game/enemy2.png',
                            '../images/game/enemy3.png',
                            '../images/game/enemy4.png',
                            '../images/game/enemy5.png',
                            '../images/game/enemy6.png',
                            '../images/game/enemy7.png',
                            
                            '../images/game/revolver.png',
                            '../images/game/uzi.png',
                            '../images/game/ak47.png',
                            
                            '../images/game/game1.png',
                            '../images/game/game2.png',
                            '../images/game/game3.jpg',
                        
                        
                            '../images/game/m9.png',
                            '../images/game/uziPick.png',
                            '../images/game//ak47pick.png',
                            
                            '../images/game//shootedHole.png',
                            
                            
                            '../images/game/grayBackground.png',
                            
                            '../images/game/healthImg.png',
                            '../images/game/helicopter.png',
                            '../images/game/healthHelicopter.png',
                            
                            '../images/game/myBlood.png',
                            
                                                        ];
        
    },
    
    preloadImages: function (srcs, imgs, audios) {
    	var self = this;
        var loadingBar = document.getElementById('loadingBar');
        var backgroundImage = document.getElementById('container');
        var img;
        var remaining = srcs.length;
        for (var i = 0; i < srcs.length; i++) {
        
            img = new Image();
            img.onload = function() {
                loadingBar.value = i*5;
                --remaining;
                if (remaining === 0){
                    loadingBar.remove();
                    backgroundImage.style.backgroundImage = "url("+imgs[17].src+")";
                    var pickLevel = new LevelGunPick(
                    document.getElementById('gameCanvas').getContext('2d'),
                    self.id,
                    imgs,
                    audios,
                    0,
                    0
                            );
                    
                    
                }
            };
            img.src = srcs[i];
            imgs.push(img);
        }
    },

    loadImages : function (audios) {
        var images = [];
        this.preloadImages(this.imageSrcs, images, audios);
    },
    
   
    
    
});


